home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / PRUS101.ZIP / FSPEAKER.PAS < prev    next >
Pascal/Delphi Source File  |  1994-12-19  |  25KB  |  1,016 lines

  1. Unit FSpeaker; { FIDO unit: Handling of and sound effects for the PC speaker }
  2.  (***************************************************************************
  3.  
  4.            RELEASE 1.04 - as first contained in the file PRUS101.LZH
  5.                  by Orazio Czerwenka, 2:2450/540.55,  GERMANY
  6.  
  7.                  --------------------------------------------
  8.                   organized for Fido's PASCAL related echoes
  9.                  --------------------------------------------
  10.  
  11.      06/07/1994 to 07/04/1994 by Orazio Czerwenka, 2:2450/540.55, GERMANY
  12.      07/05/1994 to 07/15/1994 by Wolfram Sieber,   2:2453/90.6,   GERMANY
  13.      07/16/1994 to --/--/---- by Orazio Czerwenka, 2:2450/540.55, GERMANY
  14.  
  15.      ====================================================================
  16.  
  17.       Currently there is nobody who is interrested in further supporting
  18.       this unit as the 'unit's current organizer', even though there are
  19.       still some useful routines missing for those who excessivly want
  20.       to use PC speaker sounds in there own programs.
  21.  
  22.       Probably Pawel Ostapczuk will take over this part for future
  23.       releases, but we don't know that definitely by now.
  24.  
  25.       So if you've got yourself any more useful source you wish to
  26.       contribute to this unit or are interessted in becoming its new
  27.       'current organizer' send your sources or mails to the projects
  28.       'current' general supervisor:
  29.  
  30.                 --------------------------------------------
  31.                   Orazio Czerwenka, 2:2450/540.55, GERMANY
  32.                 --------------------------------------------
  33.  
  34.      ====================================================================
  35.  
  36.            As far as third party copyrights are not violated this
  37.            source code is hereby placed to the public domain. Use
  38.            it whatever way you want, but use AT YOUR OWN RISK.
  39.  
  40.            In case you should modify the source rather send your
  41.            modifications to the unit's current organizer (see above for
  42.            NM address) than to spread it on your own. This will help to
  43.            keep the unit updated and grant a certain standard to all
  44.            other users as well.
  45.  
  46.            The unit is currently still under work. So it might greatly
  47.            benefit of your participation.
  48.  
  49.            Those who contributed to the following piece of source,
  50.            listed in alphabethical order:
  51.         ================================================================
  52.            Bill Buchanan, Christian Clemens, Orazio Czerwenka, Bjorn
  53.            Felten, Marcus Hardt, Mark Lewis, Max Maischein, Pawel
  54.            Ostapczuk, Peter Schuette, Wolfram Sieber, ...
  55.         ================================================================
  56.            YOUR NAME WILL APPEAR HERE IF YOU CONTRIBUTE USEFUL SOURCE.
  57.  
  58.            Special thanks to Max Maischein for his kind permission to
  59.             'exploit' his freeware collection of units 'SUX V. 1.0'.
  60.  
  61.            Credits in your own programs are as welcome as unnecessary.
  62.  
  63.  ***************************************************************************)
  64.  
  65. {$I FDEFINE.DEF}               { use the projects general conditional defines
  66.                                  and compiler directives ... }
  67.  
  68. {$R-}                          { ... and use the unit's specific defines
  69.                                  afterwards. }
  70.  
  71. Interface
  72. Uses
  73.   {$IFDEF CRT}
  74.     CRT                        
  75.   {$ENDIF}
  76.   {$IFDEF FCRT}
  77.   {$IFDEF CRT} , {$ENDIF}
  78.     FCRT                        (* for hardware independent delay *)
  79.   {$ENDIF}
  80.     ;
  81.  
  82. const
  83.   SoundsEnabled : boolean = TRUE;       {read/write }
  84.  
  85. { overloaded CRT routines: }
  86. procedure nosound;                      { replaces CRT's nosound }
  87. procedure sound (hertz : word);         { replaces CRT's sound }
  88.  
  89. { routines to save redunant code: }
  90. Procedure SoundOff (DelayLen  : Word);  { Turns the sound off }
  91. Procedure SoundOn  (Note, Tone,
  92.                     DelayLen  : Word);  { Turns the sound on }
  93.  
  94. { parameterless routines: }
  95. Procedure Alarm;                        { Gives an alarming sound }
  96. Procedure Beep;                         { Makes a beep }
  97. Procedure Bell;                         { Bright sound }
  98. procedure Bell2;                        { 9 * BipSound }
  99. procedure Bip;                          { 1050 Hz, 30 ms }
  100. Procedure Boop;                         { Makes a boop }
  101. procedure Bop;                          { 50 Hz, 30 ms }
  102. Procedure BuzzSaw;                      { Makes a buzzsawing sound }
  103. procedure Car;
  104. procedure ClecClac;
  105. Procedure CloseWhistle;
  106. Procedure ErrorBeep;                    { Another 'deep' sounding error beep }
  107. procedure Explosion;
  108. procedure Explosion2;
  109. Procedure Falling;
  110. procedure Falling2;
  111. Procedure Fanfare;                      { The FroDo BeBiBoop }
  112. procedure Flak;
  113. procedure Gun;
  114. Procedure HiRing;                       { simulates a phone's 'high' ringing }
  115. procedure Laser;
  116. Procedure LoRing;                       { simulates a phone's 'low' ringing }
  117. Procedure MorseCode;                    { Makes some senseless morse code }
  118. procedure MP;
  119. procedure Mystic;
  120. procedure Mystic2;
  121. procedure Mystic3;
  122. procedure Mystic4;
  123. procedure Mystic5;
  124. procedure Noname1;
  125. procedure Noname2;
  126. procedure Noname3;
  127. procedure Noname4;
  128. procedure Noname5;
  129. procedure Noname6;
  130. procedure Nuke;
  131. Procedure OpenWhistle;
  132. procedure Rain;
  133. procedure RandomSound;
  134. procedure SinusBeep;
  135. procedure StartingCar;
  136. Procedure TootTootToot;                 {3 times: 444 Hz, 34 ms
  137.                                                     0 Hz, 34 ms}
  138. Procedure Warning;
  139. Procedure WindowsBeep;                  { A rather crude windows - wrong -
  140.                                           key pressed - sound }
  141. Procedure WrongSequence;                 { plays the 1st octave with swapped
  142.                                            'g' and 'a' }
  143. Procedure Zip1;                          { Makes a sound like ZZZZip }
  144. Procedure Zip2;                          { Makes a sound like ZZZZiiip }
  145.  
  146. { routines with parameters: }
  147. Procedure Beam   (Heigth : Word);       { Makes a 'beam' sound }
  148. procedure Ploing (step   : byte);       { Makes a sawing noise. }
  149. Procedure Zap    (Key    : Word);       { Makes a sound like ZZZZaaap }
  150.  
  151. {----------------------------------------------------------------------------}
  152.  
  153. Implementation
  154.  
  155. {-overloaded CRT routines--------------------------------------------------1-}
  156.  
  157. procedure nosound; assembler;
  158. {turns the speaker off}
  159. { Original author: Mark Lewis }
  160. asm
  161.   IN     AL,61h
  162.   AND    AL,0FCh
  163.   OUT    61h,AL
  164. end;
  165.  
  166. { -------------------------------------------------------------------------- }
  167.  
  168. procedure sound (hertz : word); Assembler;
  169. {hertz is the sound frequency to send to the speaker port}
  170. { Original author: Mark Lewis }
  171. asm
  172.   MOV    BX,SP
  173.   MOV    BX,&hertz
  174.   MOV    AX,34DDh
  175.   MOV    DX,0012h
  176.   CMP    DX,BX
  177.   JNB    @J1
  178.   DIV    BX
  179.   MOV    BX,AX
  180.   IN     AL,61h
  181.   TEST   AL,03h
  182.   JNZ    @J2
  183.   OR     AL,03h
  184.   OUT    61h,AL
  185.   MOV    AL,-4Ah
  186.   OUT    43h,AL
  187. @J2:
  188.   MOV    AL,BL
  189.   OUT    42h,AL
  190.   MOV    AL,BH
  191.   OUT    42h,AL
  192. @J1:
  193. end;
  194.  
  195. {-overloaded CRT routines--------------------------------------------------9-}
  196.  
  197. {-routines to save redunant code-------------------------------------------1-}
  198.  
  199. Procedure SoundOff ( DelayLen : Word );
  200. { Original author: Max Maischein
  201.   Modified by Wolfram Sieber }
  202. Begin
  203.   NoSound;
  204.   If NOT SoundsEnabled then exit;
  205.   Delay( DelayLen );
  206. End;
  207.  
  208. { -------------------------------------------------------------------------- }
  209.  
  210. Procedure SoundOn ( Note, Tone, DelayLen : Word );
  211. { Original author: Max Maischein
  212.   Modified by Wolfram Sieber }
  213. Begin
  214.   If NOT SoundsEnabled then exit;
  215.  
  216.   Sound( Note*Tone SHR 1 );
  217.   Delay( DelayLen );
  218. End;
  219.  
  220. {-routines to save redunant code-------------------------------------------9-}
  221.  
  222. {-sound effects------------------------------------------------------------1-}
  223.  
  224. Procedure Alarm;
  225. { Original author: Max Maischein
  226.   Modified by Wolfram Sieber }
  227. Var I : Byte;
  228. Begin
  229.   If NOT SoundsEnabled then exit;
  230.  
  231.   For I := 1 To 3 Do
  232.   Begin
  233.     SoundOn ( 1000,2,300 );
  234.     SoundOn (  500,1,300 );
  235.   End;
  236.   NoSound;
  237. End;
  238.  
  239. { -------------------------------------------------------------------------- }
  240.  
  241. Procedure Beam ( Heigth : Word );
  242. { Original author: Max Maischein
  243.   Modified by Wolfram Sieber }
  244. Var I : Word;
  245. Begin
  246.   If NOT SoundsEnabled then exit;
  247.  
  248.   For I := 1 To Heigth Do
  249.   Begin
  250.     SoundOn ( I * 10, 1, 5 );
  251.     SoundOff (5);
  252.   End;
  253.   For I := Heigth DownTo 1 Do
  254.   Begin
  255.     SoundOn ( I * 10, 1, 5 );
  256.     SoundOff (5);
  257.   End;
  258. End;
  259.  
  260. { -------------------------------------------------------------------------- }
  261.  
  262. Procedure Beep;
  263. { Original author: Max Maischein
  264.   Modified by Wolfram Sieber }
  265. Begin
  266.   If NOT SoundsEnabled then exit;
  267.  
  268.   SoundOn (440,2,100);
  269.   NoSound;
  270. End;
  271.  
  272. { -------------------------------------------------------------------------- }
  273.  
  274. Procedure Bell;
  275. { Original author: Max Maischein }
  276. Begin
  277.   If NOT SoundsEnabled then exit;
  278.  
  279.   SoundOn (660,1,100);
  280.   NoSound;
  281. End;
  282.  
  283. { -------------------------------------------------------------------------- }
  284.  
  285. procedure Bell2;
  286. {Original author: Wolfram Sieber}
  287. const
  288.   BellDelay = 30;
  289. var
  290.   i : byte;
  291. begin
  292.   If NOT SoundsEnabled then exit;
  293.  
  294.   for i:=1 to 9 do begin
  295.     Bip;
  296.     SoundOff (BellDelay)
  297.   end
  298. END;
  299.  
  300. { -------------------------------------------------------------------------- }
  301.  
  302. procedure Bip;
  303. {Original author: Wolfram Sieber}
  304. begin
  305.   If NOT SoundsEnabled then exit;
  306.  
  307.   SoundOn (1050, 1, 30);
  308.   NoSound;
  309. END;
  310.  
  311. { -------------------------------------------------------------------------- }
  312.  
  313. Procedure Boop;
  314. { Original author: Max Maischein }
  315. Begin
  316.   If NOT SoundsEnabled then exit;
  317.  
  318.   SoundOn (220,2,100);
  319.   NoSound;
  320. End;
  321.  
  322. { -------------------------------------------------------------------------- }
  323.  
  324. procedure Bop;
  325. {Original author: Wolfram Sieber}
  326. begin
  327.   If NOT SoundsEnabled then exit;
  328.  
  329.   SoundOn (50, 1, 30);
  330.   NoSound;
  331. END;
  332.  
  333. { -------------------------------------------------------------------------- }
  334.  
  335. Procedure BuzzSaw;
  336. { Original author: Max Maischein
  337.   Modified by Wolfram Sieber }
  338. Var I : Word;
  339. Begin
  340.   If NOT SoundsEnabled then exit;
  341.  
  342.   For I := 500 DownTo 1 Do
  343.   Begin
  344.     SoundOn ( I * 10, 1, 5 );
  345.     SoundOff (5);
  346.   End;
  347. End;
  348.  
  349. { -------------------------------------------------------------------------- }
  350.  
  351. procedure Car;
  352. { Original author: Pawel Ostapczuk
  353.   Modified by Wolfram Sieber }
  354. var i:integer;
  355. begin
  356.   If NOT SoundsEnabled then exit;
  357.  
  358.   for i:=10 to 540 do
  359.     SoundOn (round(1000*sin(i * 1 div 2)), 1, 1);
  360.   nosound;
  361. end;
  362.  
  363. { -------------------------------------------------------------------------- }
  364.  
  365. procedure ClecClac;
  366. {Original author: Wolfram Sieber}
  367. const
  368.   Clec = 250;
  369.   Clac = 200;
  370. begin
  371.   If NOT SoundsEnabled then exit;
  372.  
  373.   SoundOff (1); SoundOn (Clec, 1, 55);
  374.   SoundOff (1); SoundOn (Clac, 1, 55);
  375.   NoSound;
  376. END;
  377.  
  378. { -------------------------------------------------------------------------- }
  379.  
  380. Procedure CloseWhistle;
  381. { Original author: Bill Buchanan
  382.   Modified by Wolfram Sieber }
  383. Var
  384.   Frequency: Integer;
  385. begin
  386.   If SoundsEnabled then
  387.     For Frequency := 1000 downto 500 do
  388.     begin
  389.       Delay(1);
  390.       Sound(Frequency)
  391.     end;
  392.   NoSound
  393. end;
  394.  
  395. { -------------------------------------------------------------------------- }
  396.  
  397. Procedure ErrorBeep;
  398. { Original author: Peter Schuette }
  399. Begin
  400.   If NOT SoundsEnabled then exit;
  401.  
  402.   SoundOn(50,1,500);
  403.   NoSound;
  404. End;
  405.  
  406. { -------------------------------------------------------------------------- }
  407.  
  408. procedure Explosion;
  409. { Original author: Pawel Ostapczuk
  410.   Modified by Wolfram Sieber }
  411. var i: integer;
  412. begin
  413.   If NOT SoundsEnabled then exit;
  414.  
  415.   for i:=10 to 240 do
  416.     SoundOn (round(500*sin(i * 1)), 1, 1);
  417.   nosound;
  418. end;
  419.  
  420. { -------------------------------------------------------------------------- }
  421.  
  422. procedure Explosion2;
  423. { Original author: Pawel Ostapczuk
  424.   Modified by Wolfram Sieber }
  425. var i: integer;
  426. begin
  427.   If NOT SoundsEnabled then exit;
  428.  
  429.   for i:=1000 downto 200 do
  430.     SoundOn(random(i+100), 1, 2);
  431.   nosound;
  432. end;
  433.  
  434. { -------------------------------------------------------------------------- }
  435.  
  436. Procedure Falling;
  437. { Original author: Max Maischein
  438.   Modified by Wolfram Sieber }
  439. Var I : Word;
  440. Begin
  441.   If NOT SoundsEnabled then exit;
  442.  
  443.   For I := 50 DownTo 20 Do
  444.   Begin
  445.     SoundOn  ( I * 10, 3, 50 );
  446.     SoundOff ( 20 );
  447.   End;
  448. End;
  449.  
  450. { -------------------------------------------------------------------------- }
  451.  
  452. procedure Falling2;
  453. { Original author: Pawel Ostapczuk
  454.   Modified by Wolfram Sieber }
  455. var i: integer;
  456. begin
  457.   If NOT SoundsEnabled then exit;
  458.  
  459.   for i:=3000 downto 650 do
  460.     SoundOn (i, 1, 1);
  461.   nosound;
  462. end;
  463.  
  464. { -------------------------------------------------------------------------- }
  465.  
  466. Procedure Fanfare;
  467. { Original author: Max Maischein
  468.   Modified by Wolfram Sieber }
  469. Begin
  470.   If NOT SoundsEnabled then exit;
  471.  
  472.   Bell;
  473.   Beep;
  474.   Boop;
  475. End;
  476.  
  477. { -------------------------------------------------------------------------- }
  478.  
  479. procedure flak;
  480. { Original author: Pawel Ostapczuk
  481.   Modified by Wolfram Sieber }
  482. var i:integer;
  483. begin
  484.   If NOT SoundsEnabled then exit;
  485.  
  486.   delay(100);
  487.   for i:=10 to 550 do
  488.     SoundOn (round(1000*sin(i * 2)), 1, 1);
  489.   nosound;
  490. end;
  491.  
  492. { -------------------------------------------------------------------------- }
  493.  
  494. procedure Gun;
  495. { Original author: Pawel Ostapczuk
  496.   Modified by Wolfram Sieber }
  497. var i:integer;
  498. begin
  499.   If NOT SoundsEnabled then exit;
  500.  
  501.   for i:= 250 to 400 do
  502.     SoundOn (random(4000-10*i)-50, 1, 1);
  503.   nosound;
  504. end;
  505.  
  506. { -------------------------------------------------------------------------- }
  507.  
  508. Procedure HiRing;
  509. { Original author: Bjorn Felten,
  510.   modifications Orazio Czerwenka,
  511.   modification by Wolfram Sieber }
  512. var i:word;
  513. begin
  514.   If NOT SoundsEnabled then exit;
  515.  
  516.   for i:=0 to 6 do
  517.   begin
  518.     soundon(523,2,50);
  519.     soundon(659,2,50);
  520.   end;
  521.   nosound
  522. end;
  523.  
  524. { -------------------------------------------------------------------------- }
  525.  
  526. procedure Laser;
  527. { Original author: Pawel Ostapczuk
  528.   Modified by Wolfram Sieber }
  529. var i:integer;
  530. begin
  531.   If NOT SoundsEnabled then exit;
  532.  
  533.   for i:= 0 to 500 do begin
  534.     Sound (random(5500-10*i)-50);  {SoundOn is too slow}
  535.     Delay (1);                     {to be used in this case}
  536.   end;
  537.   nosound;
  538. end;
  539.  
  540. { -------------------------------------------------------------------------- }
  541.  
  542. Procedure LoRing;
  543. { Original author: Bjorn Felten,
  544.   modifications Orazio Czerwenka,
  545.   modification by Wolfram Sieber }
  546. var i:word;
  547. begin
  548.   If NOT SoundsEnabled then exit;
  549.  
  550.   for i:=0 to 6 do
  551.   begin
  552.     soundon(523,1,50);
  553.     soundon(659,1,50);
  554.   end;
  555.   nosound
  556. end;
  557.  
  558. { -------------------------------------------------------------------------- }
  559.  
  560. Procedure MorseCode;
  561. { Original author: Max Maischein
  562.   Modified by Wolfram Sieber }
  563. Var I : Word;
  564. Begin
  565.   If NOT SoundsEnabled then exit;
  566.  
  567.   For I := 1 To 10 Do
  568.   Begin
  569.     SoundOn ( 600, 2, 100 );
  570.     SoundOff ( 30 + Random (200) );
  571.   End;
  572. End;
  573.  
  574. { -------------------------------------------------------------------------- }
  575.  
  576. procedure MP;
  577. { Original author: Pawel Ostapczuk
  578.   Modified by Wolfram Sieber }
  579. var i:integer;
  580. begin
  581.   If NOT SoundsEnabled then exit;
  582.  
  583.   for i:= 250 to 290 do
  584.     SoundOn (random(10*i)-60, 1, 1);
  585.   nosound;
  586.   delay(10);
  587. end;
  588.  
  589. { -------------------------------------------------------------------------- }
  590.  
  591. procedure Mystic;
  592. { Original author: Pawel Ostapczuk
  593.   Modified by Wolfram Sieber }
  594. var i:integer;
  595. begin
  596.   If NOT SoundsEnabled then exit;
  597.  
  598.   for i:= 800 to 2000 do
  599.     SoundOn (random(3*5000-4*10*i)-50, 1, 3);
  600.   nosound;
  601. end;
  602.  
  603. { -------------------------------------------------------------------------- }
  604.  
  605. procedure Mystic2;
  606. { Original author: Pawel Ostapczuk
  607.   Modified by Wolfram Sieber }
  608. var i:integer;
  609. begin
  610.   If NOT SoundsEnabled then exit;
  611.  
  612.   for i:= 800 to 2000 do begin
  613.     SoundOn (random(3*5000-4*10*i)-50, 1, 2);
  614.     SoundOn (5500-(i), 1, 1);
  615.   end;
  616.   nosound;
  617.   delay(50);
  618.   {for i:=10 to 250 do begin
  619.      SoundOn (random(500+i*2)+500, 1, 2);
  620.   end;}
  621.  
  622.   for i:=1000*2 downto 200*2 do
  623.     SoundOn (random(i div (2+ i div 10000) +100), 1, 2);
  624.   nosound;
  625. end;
  626.  
  627. { -------------------------------------------------------------------------- }
  628.  
  629. Procedure Mystic3;
  630. { Original author: Pawel Ostapczuk
  631.   Modified by Wolfram Sieber }
  632. var i,x: Integer;
  633. begin
  634.   If NOT SoundsEnabled then exit;
  635.  
  636.   i:=30;
  637.   x:=30;
  638.   repeat
  639.     SoundOn (i, 1, 1);
  640.     SoundOn (x, 1, 2);
  641.     inc(i,2);
  642.     inc(x,4);
  643.   until (x>5000) {or (keypressed)};
  644.   Nosound;
  645. end;
  646.  
  647. { -------------------------------------------------------------------------- }
  648.  
  649. Procedure Mystic4;
  650. { Original author: Pawel Ostapczuk
  651.   Modified by Wolfram Sieber }
  652. var i,x: Integer;
  653. begin
  654.   If NOT SoundsEnabled then exit;
  655.  
  656.   i:=30;
  657.   x:=30;
  658.   repeat
  659.     SoundOn (i, 1, 1); Nosound;
  660.     SoundOn (x, 1, 2); Nosound;
  661.     inc(i,2);
  662.     inc(x,4);
  663.   until (x>5000) {or (keypressed)};
  664.   Nosound;
  665. end;
  666.  
  667. { -------------------------------------------------------------------------- }
  668.  
  669. procedure Mystic5;
  670. { Original author: Pawel Ostapczuk
  671.   Modified by Wolfram Sieber }
  672. var i: integer;
  673. begin
  674.   If NOT SoundsEnabled then exit;
  675.  
  676.   for i:=500 to 2700 do
  677.     SoundOn (random(1000)+2*i-500, 1, 1);
  678.   nosound;
  679. end;
  680.  
  681. { -------------------------------------------------------------------------- }
  682.  
  683. procedure Noname1;
  684. {Original author: Wolfram Sieber}
  685. var
  686.   i : word;
  687. begin
  688.   If NOT SoundsEnabled then exit;
  689.  
  690.   for i:=1 to 17 do begin
  691.     SoundOn (i*100, 1, 13);
  692.     NoSound;
  693.     SoundOn (1500, 1, 13);
  694.     NoSound;
  695.   end;
  696. END;
  697.  
  698. { -------------------------------------------------------------------------- }
  699.  
  700. procedure Noname2;
  701. {Original author: Wolfram Sieber}
  702. var
  703.   i : word;
  704. begin
  705.   If NOT SoundsEnabled then exit;
  706.  
  707.   for i:=200 to 2500 do begin
  708.     SoundOn (500, 1, 1);
  709.     NoSound;
  710.     SoundOn (i, 1, 1);
  711.   end;
  712.   nosound
  713. END;
  714.  
  715. { -------------------------------------------------------------------------- }
  716.  
  717. procedure Noname3;
  718. { Original author: Pawel Ostapczuk
  719.   Modified by Wolfram Sieber }
  720. var i:integer;
  721. begin
  722.   If NOT SoundsEnabled then exit;
  723.  
  724.   for i:=0 to 1000 do
  725.     SoundOn(i*i, 1, 1);
  726.   nosound;
  727. end;
  728.  
  729. { -------------------------------------------------------------------------- }
  730.  
  731. procedure Noname4;
  732. { Original author: Pawel Ostapczuk
  733.   Modified by Wolfram Sieber }
  734. var i:integer;
  735. begin
  736.   If NOT SoundsEnabled then exit;
  737.  
  738.   for i:=0 to 1000 do
  739.     SoundOn (i mod 100, 1, 1);
  740.   nosound;
  741. end;
  742.  
  743. { -------------------------------------------------------------------------- }
  744.  
  745. procedure Noname5;
  746. { Original author: Pawel Ostapczuk
  747.   Modified by Wolfram Sieber }
  748. var i,a:integer;
  749. begin
  750.   If NOT SoundsEnabled then exit;
  751.  
  752.   for i:=0 to 10 do begin
  753.     a:=a+500;
  754.     SoundOn (a, 1, 10);
  755.   end;
  756.   nosound;
  757. end;
  758.  
  759. { -------------------------------------------------------------------------- }
  760.  
  761. procedure Noname6;
  762. { Original author: Christian Clemens
  763.   Modified by Wolfram Sieber }
  764. var i,c : byte;
  765.     hz : word;
  766. begin
  767.   If NOT SoundsEnabled then exit;
  768.  
  769.   for c:=1 to 3 do
  770.    for i:=1 to 100 do
  771.     begin
  772.      hz := i*180+100;
  773.      SoundOn ( hz, 1, 5);
  774.      nosound;
  775.     end;
  776. end;
  777.  
  778. { -------------------------------------------------------------------------- }
  779.  
  780. Procedure Nuke;
  781. { Original author: Pawel Ostapczuk
  782.   Modified by Wolfram Sieber }
  783. var i:integer;
  784. begin
  785.   If NOT SoundsEnabled then exit;
  786.  
  787.   for i:= 0 to 5000 do begin
  788.     nosound;
  789.     SoundOn (random(50+i)-50, 1, 3);
  790.   end;
  791.   nosound;
  792. end;
  793.  
  794. { -------------------------------------------------------------------------- }
  795.  
  796. Procedure OpenWhistle;
  797. { Original author: Bill Buchanan
  798.   Modified by Wolfram Sieber }
  799. Var
  800.   Frequency : Integer;
  801. begin
  802.   If NOT SoundsEnabled then exit;
  803.  
  804.   For Frequency := 500 to 1000 do
  805.   begin
  806.     Delay(1);
  807.     Sound(Frequency)
  808.   end;
  809.   NoSound
  810. end;
  811.  
  812. { -------------------------------------------------------------------------- }
  813.  
  814. procedure Ploing (step : byte);
  815. {Original author: Wolfram Sieber}
  816. var       {Fine "Step"s: 10..2}
  817.   i : byte;
  818. begin
  819.   If NOT SoundsEnabled then exit;
  820.  
  821.   For i:=1 to 100 do begin
  822.     SoundOn (i*10, 1, Step);
  823.     NoSound;
  824.   end;
  825. END;
  826.  
  827. { -------------------------------------------------------------------------- }
  828.  
  829. Procedure Rain;
  830. { Original author: Pawel Ostapczuk
  831.   Modified by Wolfram Sieber }
  832. begin
  833.   If NOT SoundsEnabled then exit;
  834.  
  835.   SoundOn (Random(30)+20, 1, 3);
  836.   SoundOff (Random(200));
  837. end;
  838.  
  839. { -------------------------------------------------------------------------- }
  840.  
  841. procedure RandomSound;
  842. {Original author: Wolfram Sieber}
  843. var
  844.   i : byte;
  845. begin
  846.   If NOT SoundsEnabled then exit;
  847.  
  848.   for i:=1 to 24 do begin
  849.     SoundOn  ((random (3)+1)*222, 1, 10);
  850.     SoundOff (75);
  851.   end
  852. END;
  853.  
  854. { -------------------------------------------------------------------------- }
  855.  
  856. procedure SinusBeep;
  857. { Original author: Pawel Ostapczuk
  858.   Modified by Wolfram Sieber }
  859. var i:integer;
  860. begin
  861.   If NOT SoundsEnabled then exit;
  862.  
  863.   for i:= 0 to 5 do
  864.     SoundOn (round(2000*sin(1000*i))-100, 1, 20);
  865.   nosound;
  866. end;
  867.  
  868. { -------------------------------------------------------------------------- }
  869.  
  870. procedure StartingCar;
  871. {Original author: Wolfram Sieber}
  872. var
  873.   i : byte;
  874. begin
  875.   If NOT SoundsEnabled then exit;
  876.  
  877.   for i:=30 to 120 do begin
  878.     SoundOn (i, 1, 50);
  879.     nosound
  880.   end;
  881. END;
  882.  
  883. { -------------------------------------------------------------------------- }
  884.  
  885. procedure TootTootToot;
  886. {Original author: Wolfram Sieber}
  887. const
  888.   TootDelay = 34;
  889. var
  890.   i : byte;
  891. begin
  892.   If NOT SoundsEnabled then exit;
  893.  
  894.   for i:=1 to 3 do begin
  895.     SoundOn (444, 1, TootDelay);
  896.     SoundOff (TootDelay)
  897.   end
  898. END;
  899.  
  900. { -------------------------------------------------------------------------- }
  901.  
  902. Procedure Warning;
  903. { Original author: Christian Clemens
  904.   Modified by Wolfram Sieber }
  905. Var X : Byte;
  906. Begin
  907.   If NOT SoundsEnabled then exit;
  908.  
  909.   For X := 1 To 3 Do
  910.    Begin
  911.     Sound ( 125 ); Delay ( 50 ); NoSound;
  912.     Delay ( 25 );
  913.    End;
  914. End;
  915.  
  916. { -------------------------------------------------------------------------- }
  917.  
  918. Procedure WindowsBeep;
  919. { Original author: Max Maischein
  920.   Modified by Wolfram Sieber }
  921. Begin
  922.   If NOT SoundsEnabled then exit;
  923.  
  924.   SoundOn( 860,2,30 );
  925.   SoundOn( 660,2,15 );
  926.   NoSound;
  927. End;
  928.  
  929. { -------------------------------------------------------------------------- }
  930.  
  931. procedure WrongSequence;
  932. {Original author: Wolfram Sieber}
  933. var
  934.   Note : byte;
  935.   Octave : array [1..7] of byte;
  936. begin
  937.   If NOT SoundsEnabled then exit;
  938.  
  939.   Octave [1] := 131; {instead of normally 130.81 Hz}
  940.   Octave [2] := 147; {instead of normally 146.83 Hz}
  941.   Octave [3] := 165; {instead of normally 164.81 Hz}
  942.   Octave [4] := 175; {instead of normally 174.61 Hz}
  943.   Octave [6] := 196;
  944.   Octave [5] := 220;
  945.   Octave [7] := 247; {instead of normally 246.94 Hz}
  946.   for Note := 1 to 7 do begin
  947.     SoundOn (round (Octave [Note]), 1, 50);
  948.     SoundOff (30);
  949.   end;
  950. END;
  951.  
  952. { -------------------------------------------------------------------------- }
  953.  
  954. Procedure Zap( Key : Word );
  955. { Original author: Max Maischein
  956.   Modified by Wolfram Sieber }
  957. VAR I,J,K,L : Word;
  958. Begin
  959.   If NOT SoundsEnabled then exit;
  960.  
  961.   For I := 1 To 11 Do
  962.   Begin
  963.     J := 1 * 23 + ( 51 - Random ( Key ) );
  964.     For K := 1 To 5 Do
  965.     Begin
  966.       For L := 1 To 37 - K * 2 Do Sound ( ( L+J+K*2)*3 Div 2 );
  967.       Delay ( Key );
  968.       Inc ( J , 31 );
  969.     End;
  970.   End;
  971.   NoSound ;
  972. End;
  973.  
  974. { -------------------------------------------------------------------------- }
  975.  
  976. procedure Zip1;
  977. {Original author: Wolfram Sieber}
  978. var
  979.   i : byte;
  980. begin
  981.   If NOT SoundsEnabled then exit;
  982.  
  983.   for i:=1 to 150 do
  984.     SoundOn (i*100, 1, 1);
  985.   nosound
  986. END;
  987.  
  988. { -------------------------------------------------------------------------- }
  989.  
  990. procedure Zip2;
  991. {Original author: Wolfram Sieber}
  992. var
  993.   i : byte;
  994. begin
  995.   If NOT SoundsEnabled then exit;
  996.  
  997.   for i:=1 to 150 do begin
  998.     SoundOn (i*100, 1, 1);
  999.     nosound;
  1000.   end;
  1001. END;
  1002.  
  1003. {-sound effects------------------------------------------------------------9-}
  1004.  
  1005. (* procedure InitFSPEAKER;
  1006. begin
  1007.   EnableSpeaker;
  1008. end;
  1009.  
  1010. {$IFOPT O-}
  1011. Begin
  1012.   InitFSPEAKER;
  1013. {$ENDIF} *)
  1014. End.
  1015.  
  1016.